<template>
    <div class="form1 pb100">
        <sc-title>主要特长介绍及初中阶段主要获奖情况</sc-title>
        <van-form ref="van-form">
            <!--获奖情况-->
            <van-cell title="获奖情况">
                <!-- 使用 right-icon 插槽来自定义右侧图标 -->
                <template #label>
                    <van-field
                        v-model="subForm.awardDescription"
                        type="textarea"
                        name="awardDescription"
                        placeholder="请填写获奖情况"
                        :rules="[{ required: true, message: '请填写获奖情况' }]"
                    />
                </template>
            </van-cell>


        </van-form>

        <div class="fixed-btn" v-if="!isFous">
            <sc-button type="stop" width="150px" @click="$emit('changeStep',2)">上一步</sc-button>
            <div class="ml10">
                <sc-button width="190px" @click="onSubmit">提交</sc-button>
            </div>
        </div>
    </div>
</template>

<script>
export default {
    name: "form4",
    data() {
        return {
            subForm: {
                awardDescription: '',//报考类型
            },
        }
    },

    created() {
        if (this.$ls.get('subForm4')) this.subForm = this.$ls.get('subForm4')
    },
    destroyed() {
        this.$ls.set('subForm4', this.subForm)
    },
    methods: {
        async onSubmit() {
            const subForm1 = this.$ls.get('subForm1')
            const subForm2 = this.$ls.get('subForm2')
            const subForm3 = this.$ls.get('subForm3')
            const subForm4 = this.subForm

            const {code, data} = await this.$api.studentForm.submitForm({
                ...subForm1,
                ...subForm2,
                ...subForm3,
                ...subForm4,
                openId: this.$ls.get('openId') || (this.isDev && 'o7C0b5oOJeRBVdutjaGRcjBiKhe4'),
            })
            if (code === 200) {
                this.$toast.success('报名成功\n等待老师\n审核')
                setTimeout(() => {
                    this.$router.push('/success')
                }, 1000)
            }
        },
        reset() {
            this.subForm = {
                awardDescription: '',//报考类型
            }
            this.$toast.success('重置成功！')
            this.$ls.set('subForm4', this.subForm)
        }
        ,

    },
}
</script>
<style lang='scss' scoped>
.form1 {
    /deep/ .van-cell {
        .van-field {
            padding: 0;
        }
    }

}
</style>
